/*
 * @Author: fumin 31408026@qq.com
 * @Date: 2025-11-07 15:57:36
 * @LastEditors: fumin 31408026@qq.com
 * @LastEditTime: 2025-11-18 20:16:42
 * @FilePath: /xinjiangkf-miniapp/vite.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import { fileURLToPath, URL } from 'node:url'

export default defineConfig({
    plugins: [uni()],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src',
                import.meta.url))
        }
    },
    server: {
        port: 8080,
        proxy: {
            // 代理所有以 /xjwechat 开头的请求
            '/xjwechat': {
                target: 'https://kf.xj.189.cn',
                changeOrigin: true,
                secure: true,
                rewrite: (path) => path
            },
            // 如果需要代理其他路径，可以继续添加
            // '/api': {
            //     target: 'https://kf.xj.189.cn',
            //     changeOrigin: true,
            //     secure: true
            // }
        }
    }
})